package com.atguigu.test.po;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author zp
 * @version 1.0
 * @description: 生命周期测试类
 * @date 2022/12/14 20:07
 */
@Slf4j
public class LifeCycleBean {
    public LifeCycleBean() {
        log.info("构造方法");
    }

    @Autowired
    public void autowired(@Value("${JAVA_HOME}") String home) {
        log.info("依赖注入：[{}]", home);
    }

    @PostConstruct
    public void init() {
        log.info("初始化方法");
    }

    @PreDestroy
    public void destroy() {
        log.info("销毁方法");
    }
}
